"use strict";
const { Model } = require("sequelize");
module.exports = (sequelize, DataTypes) => {
  class ServiceDoc extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      ServiceDoc.belongsTo(models.Service, {
        foreignKey: "service_id",
        onDelete: "CASCADE",
      });
      // define association here
    }
  }
  ServiceDoc.init(
    {
      description: DataTypes.TEXT,
      problem: DataTypes.TEXT,
    },
    {
      sequelize,
      modelName: "ServiceDoc",
      tableName: "servicedocs",
    }
  );
  return ServiceDoc;
};
